﻿@model VideoCache.Server.MVCWeb.Areas.Admin.Models.UserRoleModel
@{
    ViewBag.Title = "权限";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
@section script
{
    <script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
}
<h2 class="pageTitle">@ViewBag.Title</h2>
@using (Html.BeginForm())
{
@Html.HiddenFor(model => model.UserId)
@Html.HiddenFor(model => model.UserName)
@Html.ValidationSummary(true)
<table class="table-form">
    <tr>
        <td class="label">@Html.LabelFor(model => model.UserName)</td>
        <td>
            @Html.DisplayFor(model => model.UserName)
            @Html.ValidationMessageFor(model => model.UserName)
        </td>
    </tr>
    <tr>
        <td class="label">@Html.LabelFor(model => model.Roles)</td>
        <td>
            @foreach (var item in (List<VideoCache.Server.Model.RoleInfo>)ViewBag.Roles)
            {
                if (Model.Roles.Contains(item.Id))
                {
                    <label><input id="Roles" name="Roles" type="checkbox" value="@item.Id" checked="checked" /> @item.DisplayName</label>
                }
                else
                {
                    <label><input id="Roles" name="Roles" type="checkbox" value="@item.Id" /> @item.DisplayName</label>
                }
            }
        </td>
    </tr>
    <tr>
        <td class="label"></td>
        <td><input type="submit" value="保存权限设置" /></td>
    </tr>
</table>
}